package com.asset.salesforce.converter;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.asset.salesforce.domain.JoinRequest;
import com.asset.salesforce.form.JoinRequestForm;

public class JoinRequestConverter {
	
	public List<JoinRequestForm> getPendingRequest(List<JoinRequest> joinRequests){
		if(joinRequests != null){
			List<JoinRequestForm>joinRequestForms = new ArrayList<JoinRequestForm>();
			for(JoinRequest joinRequest : joinRequests){
				if(joinRequest!= null){
				JoinRequestForm joinRequestForm = new JoinRequestForm();
				joinRequestForm.setfName(joinRequest.getEmp().getfName());
				joinRequestForm.setlName(joinRequest.getEmp().getlName());
				joinRequestForm.setStartDate(joinRequest.getStartDate().toString());
				joinRequestForm.setEmpId(joinRequest.getEmp().getId());
				joinRequestForm.setId(joinRequest.getId());
				joinRequestForm.setCompanyName(joinRequest.getOwner().getCompany().getCompanyName());
				joinRequestForm.setEmail(joinRequest.getEmp().getEmail());
				joinRequestForms.add(joinRequestForm);
				
			}
				}
			
			return joinRequestForms;
		}else{
			return new ArrayList<JoinRequestForm>();
		}
		
	}

}
